/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package thienphuc.patient.bo.impl;

import java.util.Date;
import java.util.List;
import thienphuc.patient.bo.NhapThuocBO;
import thienphuc.patient.dao.NhapThuocDAO;
import thienphuc.patient.dao.impl.NhapThuocDAOImpl;
import thienphuc.patient.dto.NhapThuoc;
import thienphuc.patient.dto.NhapThuocId;
import thienphuc.patient.dto.Thuoc;

/**
 *
 * @author QuocDat
 */
public class NhapThuocBOImpl implements NhapThuocBO {
    private NhapThuocDAO nhapThuocDAO;

    public NhapThuocBOImpl() {
        this.nhapThuocDAO = new NhapThuocDAOImpl(NhapThuoc.class);
    }
    
    public List<NhapThuoc> getAll() throws Exception {
        return this.nhapThuocDAO.findAll();
    }

    public NhapThuoc getById(NhapThuocId nhapThuocId) throws Exception {
        return this.nhapThuocDAO.findById(nhapThuocId);
    }

    public List<NhapThuoc> getByThuoc(Thuoc thuoc) throws Exception {
        return this.nhapThuocDAO.findByThuoc(thuoc);
    }

    public List<NhapThuoc> getByNgayNhap(Date ngayNhapStart, Date ngayNhapEnd) throws Exception {
        return this.nhapThuocDAO.findByNgayNhap(ngayNhapStart, ngayNhapEnd);
    }

    public List<NhapThuoc> getByTenCongTy(String tenCongTy) throws Exception {
        return this.nhapThuocDAO.findByTenCongTy(tenCongTy);
    }

    public boolean insertNhapThuoc(NhapThuoc nhapThuoc) throws Exception {
        return this.nhapThuocDAO.save(nhapThuoc);
    }

    public boolean updateNhapThuoc(NhapThuoc nhapThuoc) throws Exception {
        return this.nhapThuocDAO.update(nhapThuoc);
    }
}
